widgetCrombsClosest = new dynamicWidget("widgetCrombsClosest", "From A<br>Cromb", "TEXT...", "updateCrombsClosest(~~icon)", 5000, "renderCrombsClosest()", "initCrombsClosest(~~icon)")
//widgetCrombsClosest.display()

var direction = 0;
function initCrombsClosest(elementID) {
    //console.log("Init element CrombsClosest");
    updateCrombsClosest(elementID);
}

function renderCrombsClosest() {
    setTimeout(showWalletClosestCromb, 0);
}

function updateCrombsClosest(elementID) {
    //console.log("Update element CrombsClosest");
    var element = document.getElementById(elementID);
    var closest = undefined;
    if (lastCrombs !== undefined && lastCrombs.length > 0) {
        closest = lastCrombs[0];
    }
    if (closest !== undefined) {
        element.innerHTML = renderDistance(closest.distance);
    } else {
        element.innerHTML = "...";
    }
}
